/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-03-04
 * Time: 13:46
 */
public class test1 {
    /**
     * LeetCode  80  删除有序数组中的重复项 II
     */
    public int removeDuplicates(int[] nums) {
        int n = nums.length;
        if(n<=2){
            return n;
        }
        int slow = 2;
        int fast = 2;
        while(fast<n){
            if(nums[fast]!=nums[slow-2]){
                nums[slow] = nums[fast];
                slow++;
            }
            fast++;
        }
        return slow;
    }
}
